<template>
	<view class="main-page">
		<view class="top-box">
			<view class="search-box">
				<u-search searchIconColor="#007AFE" shape="square" placeholder="搜索" :clearabled="true"
					:showAction="false" :bgColor="'#fff'"></u-search>
			</view>
			<view class="not-read">
			</view>
		</view>
		<view class="tabs-box">
			<view class="tabs-item" v-for="(item,index) in tabsType" :key="item.name" @click="clickTab(item.name,index)"
				:class="{'active-tab':activeIndex==index,'active-right':activeIndex==index+1,'active-left':activeIndex==index-1}">
				{{item.name}}
			</view>
		</view>
		 <liu-indexed-list :dataList="dataList" @click="click"></liu-indexed-list>
		<tabbar :routePath="'/pages/connect/connect'" :typeBar="2" />
	</view>
</template>
<script>
	import {findUserChatData} from "@/common/api/index.js"
	export default {
		data() {
			return {
				tabsType: [{
						name: '最新'
					},
					{
						name: '新患者'
					},
					{
						name: '复发患者'
					},
					{
						name: '跟进治疗'
					},
				],
				activeIndex: 0,
				dataList: [{
					id: '1',
					name: '刘**',
					phone: '181****5576',
					img: 'https://cdn.pixabay.com/photo/2022/03/31/14/53/camp-7103189_1280.png'
				},{
					id: '123',
					name: '?刘sss',
					phone: '12221****5576',
					img: 'https://cdn.pixabay.com/photo/2022/03/31/14/53/camp-7103189_1280.png'
				}, {
					id: '456',
					name: '阿里云',
					phone: '12221****5576',
					img: 'https://cdn.pixabay.com/photo/2022/03/31/14/53/camp-7103189_1280.png'
				}, {
					id: '2',
					name: '税**',
					phone: '181****5576',
					img: 'https://cdn.pixabay.com/photo/2021/07/22/11/25/rabbit-6485072_1280.jpg'
				}, {
					id: '3',
					name: '柴**',
					phone: '181****5576',
					img: 'https://cdn.pixabay.com/photo/2020/05/19/13/35/cartoon-5190860_1280.jpg'
				}, {
					id: '4',
					name: '王**',
					phone: '181****5576',
					img: 'https://cdn.pixabay.com/photo/2020/05/19/13/32/cartoon-5190837_1280.jpg'
				}, {
					id: '5',
					name: '马**',
					phone: '181****5576',
					img: 'https://cdn.pixabay.com/photo/2023/03/07/12/45/child-7835677_1280.jpg'
				}, {
					id: '6',
					name: '韩**',
					phone: '181****5576',
					img: 'https://cdn.pixabay.com/photo/2022/11/29/19/05/boho-7625140_1280.jpg'
				}, {
					id: '7',
					name: '张**',
					phone: '181****5576',
					img: 'https://cdn.pixabay.com/photo/2020/05/19/13/32/cartoon-5190837_1280.jpg'
				}, {
					id: '8',
					name: '王**',
					phone: '181****5576',
					img: 'https://cdn.pixabay.com/photo/2020/05/19/13/35/cartoon-5190860_1280.jpg'
				}, {
					id: '9',
					name: '张**',
					phone: '18198045576',
					img: 'https://cdn.pixabay.com/photo/2021/07/22/11/25/rabbit-6485072_1280.jpg'
				}, {
					id: '10',
					name: '李**',
					phone: '181****5576',
					img: 'https://cdn.pixabay.com/photo/2022/03/31/14/53/camp-7103189_1280.png'
				}]
			};
		},
		onShow() {
			console.log(this.$store.state.socketTast)
		},
		methods: {
			clickTab(item, index) {
				this.activeIndex = index
			},
			 //点击列表回调事件
		    click(e) {
		        console.log('点击列表回调：', e)
		    }
		}
	}
</script>

<style lang="scss" scoped>
	.main-page {
		width: 100%;
		height: calc(100vh - 90rpx);
		overflow: hidden;
		.top-box {
			height: 200rpx;
			display: flex;
			flex-direction: column;
			justify-content: space-around;

			.search-box {
				width: 100%;
				padding: 0 30rpx;
			}

			.not-read {
				width: 100%;
				display: flex;
				align-items: center;
				padding: 0 30rpx;
				gap: 10rpx;
				// margin-top: 40rpx;
				font-size: 28rpx;
				font-weight: 400;
				color: #333333;

				image {
					width: 48rpx;
					height: 48rpx;
				}

				.nums {
					color: #3F86FF;
				}
			}
		}

		.tabs-box {
			width: 100%;
			display: flex;
			border-radius: 20rpx 20rpx 0rpx 0rpx;
			background: linear-gradient(#EBEFF7 50%, #fff 100%);
			overflow: hidden;
			.tabs-item {
				flex: 1;
				text-align: center;
				background-color: #EBEFF7;
				padding: 30rpx 0;
				text-align: center;
				font-weight: 500;
				color: #080808;
			}

			.active-tab {
				background-color: #fff;
				border-radius: 20rpx 20rpx 0rpx 0rpx;
				position: relative;
			}

			.active-tab::after {
				content: "";
				width: 40rpx;
				height: 8rpx;
				background: #40D49F;
				box-shadow: 0rpx 0rpx 6rpx 0rpx #40D49F;
				border-radius: 4rpx;
				position: absolute;
				bottom: 0;
				left: calc(50% - 20rpx);
			}

			.active-right {
				border-radius: 0rpx 0rpx 20rpx 0rpx;
			}

			.active-left {
				border-radius: 0rpx 0rpx 0rpx 20rpx;
			}
		}
	}
</style>